package org.example.controller;

import jakarta.annotation.Resource;
import org.example.entity.R;
import org.example.pojo.Dept;
import org.example.servcie.DeptFeignService;
import org.springframework.web.bind.annotation.*;

/**
 * @author TonySong
 * @date 2024/4/26 0026
 * @time 10:41
 */
@RestController
@RequestMapping("/feignDept")
public class DeptFeignController {

    @Resource
    private DeptFeignService  deptFeignService;

    @GetMapping("/depts")
    public R listDept(){
        return this.deptFeignService.findAll();
    }

    @PostMapping("/")
    public R save(@RequestBody Dept dept){
       return this.deptFeignService.save(dept);
    }

    @DeleteMapping("/{id}")
    public R delete(@PathVariable("id") Long id){
        return  R.success(this.deptFeignService.delete(id));
    }
}
